package com.zbkj.dal.base.enums;

import com.zbkj.dal.common.exception.CrmebException;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@AllArgsConstructor
public enum OrderSubStageType {

    /**
     * 订单子阶段类型
     */

    // ----------------- 承享订单 -----------------

    PURCHASE("购买订单", OrderType.PURCHASE),

    RENT_CREATE("承享订单创建", OrderType.RENT),

    RENT_RETURN("承享订单归还", null),

    ;

    private final String message;
    private final OrderType orderType;

    public static OrderSubStageType of(String code) {
        for (OrderSubStageType value : OrderSubStageType.values()) {
            if (StringUtils.equals(value.name(), code)) {
                return value;
            }
        }
        throw new CrmebException("不支持的类型");
    }

}
